Database management systems (DBMS) play an important role in the gathering, manipulation, classification, storage, and retrieval of information that is central to the workings of modem society.
One key application for DBMS is to manage transactions such as, for example, financial transactions. A transaction may be, for example, a single logical operation on data in the database that the DBMS manages. A transaction may involve multiple tasks that may each be carried out in turn to successfully complete a transaction. An example transaction may be to transfer funds from a savings account to a checking account. This transaction may involve a first step of debiting funds from the savings account and a second step of crediting funds to the checking account.
DBMS are often designed to exhibit a set of qualities known as Atomicity, Consistency, Isolation, and Durability (ACID) properties. Atomicity refers to the ability of the DBMS to guarantee that either all of the tasks that comprise a transaction complete successfully or that none of the tasks that comprise a transaction will be completed successfully. For example, if the task is to transfer funds from a savings account to a checking account and one of these tasks fails to complete successfully, for example, funds cannot be credited to the checking account, the DBMS will prevent the task of debiting funds from the savings account even though it may be able to be successfully completed.
Consistency refers to the ability of the DBMS to ensure that the transaction does not violate one or more integrity constraints. Integrity constraints are rules that govern how transactions may affect data. For example, an integrity constraint may hold that all accounts must have a positive balance. Therefore, a transaction that seeks to transfer funds from a savings account to a checking account will not complete successfully if so doing would leave the savings account with a negative balance, for example, if the funds to transfer are in excess of the savings account balance.
Isolation refers to the ability of the DBMS to isolate database operations. A database operation is an action, such as a transaction or a task that may be performed on an object of database data. By isolating database operations, one operation may not gain access to a database object while another operation is in the process of manipulating that object. Isolation thereby prevents data from being seen in an intermediate state. For example, while a transaction to transfer funds from a savings account to a checking account is pending, at no time may the same funds be observed in either both accounts or neither account. Therefore all transactions on an object must be performed in a series and no two transactions may be said to have commenced at exactly the same time. This property is often expressed as a DBMS having a serializable transaction history.
Durability refers to the ability of a DBMS to ensure that successful transactions may not be undone. For example, once a transaction has been reported successfully completed, a subsequent system failure will not reverse the transaction. Durable DBMS will therefore ensure that the transaction will not have to be aborted after implementing the transaction and reporting successful completion. Durability generally includes recording all successfully completed transactions into a log. The log may therefore be used to recreate the state of the database should database data become corrupted.
Two principal techniques are commonly used by DBMS to ensure ACID properties. Write ahead logging is one such technique. Here, when a transaction seeks to access an object, a lock is placed on that object so that no other transactions may gain access to that object while that transaction is pending. Redo and undo information are then recorded to the log. In the event that a task of the transaction fails, all tasks that have already been completed for that transaction may be backed out using the logged information.
Shadow logging is another such technique. In shadow logging as well, when a transaction seeks to access an object, a lock is placed on that object so that no other transactions may gain access to that object while that transaction is pending. The transaction is then performed on a copy of a relevant portion of the database, for example, the locked objects. If all tasks complete successfully, then the copy of the relevant portion of the database is activated and used as part of the database in place of the original relevant portion. If a task fails to complete successfully then the copy may be discarded.
Many DBMS maintain a single database and a single transaction log. While using only a single database and a single transaction log promotes simplicity, the requirements of users have quickly expanded to the point where a single database is often insufficient. Modern DBMS may involve multiple databases and/or transaction logs. Modern DBMS may additionally provide for high performance database access and/or distributed database access over multiple systems. In such modern DBMS, ensuring integrity of databases, for example, ensuring ACID properties, is becoming increasingly difficult.